<VirtualHost *:80>
    ServerName {{ owncloud_domain }}

    Redirect permanent / https://{{ owncloud_domain }}/
</VirtualHost>

<VirtualHost *:443>
    ServerName {{ owncloud_domain }}
    SSLEngine On

    DocumentRoot            /var/www/owncloud
    Options                 -Indexes

    ErrorLog                /var/log/apache2/owncloud.info-error_log
    CustomLog               /var/log/apache2/owncloud.info-access_log common

    php_value session_cache_limiter "public"

    <Directory "/var/www/owncloud">
        Options +FollowSymLinks
        AllowOverride All

        <IfModule mod_dav.c>
          Dav off
        </IfModule>

        SetEnv HOME /var/www/owncloud
        SetEnv HTTP_HOME /var/www/owncloud
    </Directory>

    <Directory "/var/www/owncloud/data/">
      # just in case if .htaccess gets disabled
      Require all denied
    </Directory>

    ## Please enable this manually, if needed. See also
    ## https://doc.owncloud.org/server/8.2/admin_manual/issues/index.html#apple-ios
    # Redirect 301 /.well-known/carddav /owncloud/remote.php/carddav
    # Redirect 301 /.well-known/caldav  /owncloud/remote.php/caldav
</VirtualHost>
